package br.com.vti.sisp_sicrim.model.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import br.com.crud4j.core.model.Model;

/**
 *
 * @author ednardomatos
 */
@Entity
@Table(name = "t_log_impressao", catalog = "desenvolvimento", schema = "e_sisp_sicrim")
@SequenceGenerator(name = "seq_log_impressao", sequenceName = "e_sisp_sicrim.seq_log_impressao", initialValue = 1, allocationSize = 1)
public class Impressao implements Model<Integer> {
    
    private static final long serialVersionUID = -7900920078890131658L;
    
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_log_impressao")
    private Integer id;

    @ManyToOne
    @JoinColumn(name = "usuario", referencedColumnName = "id")
    private Usuario usuario;
    
    @Column(name = "dt_impressao")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtImpressao;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "desc_conteudo_impresso")
    private String descricaoConteudo;
    
    public Impressao() {

    }
    
    public Impressao(Integer id, Usuario usuario, Date dtImpressao, String descricaoConteudo) {
		super();
		this.id = id;
		this.usuario = usuario;
		this.dtImpressao = dtImpressao;
		this.descricaoConteudo = descricaoConteudo;
	}
    
    
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Usuario getUsuario() {
		return usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}

	public Date getDtImpressao() {
		return dtImpressao;
	}

	public void setDtImpressao(Date dtImpressao) {
		this.dtImpressao = dtImpressao;
	}

	public String getDescricaoConteudo() {
		return descricaoConteudo;
	}

	public void setDescricaoConteudo(String descricaoConteudo) {
		this.descricaoConteudo = descricaoConteudo;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Impressao)) {
            return false;
        }
        Impressao other = (Impressao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "DadosFisicos[ id=" + id + " ]";
    }

    
}
